package com.csd.fragment;

import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.csd.activity.R;
import com.csd.adapter.EnterpriseAllAdapter;
import com.csd.base.BaseFragment;
import com.csd.bean.Car;
import com.csd.bean.EnterpriseOrder;

public class EnterpriseAllFragment extends BaseFragment implements OnClickListener{

	private ListView listView;
	private View v;
	private List<EnterpriseOrder> list;
	public static LinearLayout ll_cancle;
	private Button bt_no,bt_yes;
	public static TextView tv_cancle;
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.no:
			ll_cancle.setVisibility(View.GONE);
			break;
		case R.id.yes:
			ll_cancle.setVisibility(View.GONE);
		break;

		default:
			break;
		}
	}
	@Override
	protected View initView(LayoutInflater inflater) {
		// TODO Auto-generated method stub
		 v = inflater.inflate(R.layout.fragment_enterpriseall, null);
		
		return v;
	}
	@Override
	protected void initData(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		
	}
	@Override
	protected void findViewById() {
		// TODO Auto-generated method stub
		 list = new ArrayList<>();
			EnterpriseOrder order = new EnterpriseOrder();
			Car car = new Car();
			car.setCarBrand("别克凯越");
			order.setOrderId("1");
			order.setPurpose("接客户");
			order.setTakeTime("2014/11/06 08:30");
			order.setRetrunTime("2014/11/06 09:00");
			order.setApplyTime("2014-11-06 07:00");
			order.setState(0);
			order.setCar(car);
			list.add(order);
			EnterpriseOrder order1 = new EnterpriseOrder();
			Car car1 = new Car();
			car1.setCarBrand("丰田威驰");
			car1.setPlate("沪A-3245");
			car1.setImg(R.drawable.u98);
			order1.setOrderId("2");
			order1.setTakeTime("2014/11/06 08:30 ");
			order1.setRetrunTime("2014-11-06 07:00");
			order1.setState(1);
			order1.setCar(car1);
			list.add(order1);
		listView = (ListView) v.findViewById(R.id.lv_list);
		EnterpriseAllAdapter adapter = new EnterpriseAllAdapter(list, getActivity());
		listView.setAdapter(adapter);
		ll_cancle = (LinearLayout) v.findViewById(R.id.ll_cancle);
		bt_yes = (Button) v.findViewById(R.id.yes);
		bt_no = (Button) v.findViewById(R.id.no);
		tv_cancle = (TextView) v.findViewById(R.id.tv_cancle);
	}
	@Override
	protected void setListener() {
		// TODO Auto-generated method stub
		bt_no.setOnClickListener(this);
		bt_yes.setOnClickListener(this);
	}
	
}
